package com.zuoye.Serviecs;

import com.zuoye.entity.Account;
import com.zuoye.extend.Coemmt;

import java.util.concurrent.CountDownLatch;

import static com.zuoye.Serviecs.Back.accounts;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/7/14  16:56
 * @Copyright
 */
public class Atm extends Coemmt {
    public Back bank = new Back();


    public void services() {
        System.out.println("欢迎使用自动ATM机！");
        do {

            System.out.println("请输入卡号：");
            String number = scanner.next();
            System.out.println("请输入密码：");
            String password = scanner.next();
            Account account = bank.verify(number, password);
            boolean falg=false;
do {


    if (account != null) {

        count = bank.Menus(count);
        if (count == 1) {
            System.out.println("请输入存入的金额：");
            money = scanner.nextDouble();

            bank.saveMoney(account, money);


        } else if (count == 2) {
            System.out.println("请选择：1.本地取钱;   2.信用卡取钱;");
            int index = scanner.nextInt();
            bank.depositMoney(money, index, number, password);
        } else if (count == 3) {
            System.out.println("拜拜！请重新登录：");
            falg = true;
            break;
        }


    } else {
        System.out.println("无账户！或卡号或密码输入错误！ 重新输入！");
        System.out.println("-------------------------------------");
        break;
    }

}while (!falg);

        } while (true);

    }
    }


